\ProvidesFile{nkbib.bbx}[20200211]
\usepackage{xstring}
\RequireBibliographyStyle{numeric}
\ExecuteBibliographyOptions{sorting=none,minnames=3}
\InitializeBibliographyStyle{
\renewcommand{\newblockpunct}{. }
\renewcommand{\newunitpunct}{, }
\renewcommand{\bibrangedash}{\textbf{\textasciitilde}}
\renewcommand{\bibfont}{\fontspec{Times New Roman}\zihao{5}}
\renewcommand{\bibinitperiod}{}
%\setlength{\biblabelsep}{0pt}
%\sloppy
}


\newcommand{\nkartnfromdoi}[2]{%
\StrCount{#1}{#2}[\nbmatch]%
\StrCut[\nbmatch]{#1}{#2}\strfirst\strsecond
\strsecond%
}

\DeclareDatamodelFields[type=field,datatype=literal,nullok=true]{override}
\DeclareDatamodelEntryfields[article]{override}

\DeclareFieldFormat[article]{title}{#1}
\DeclareFieldFormat[article]{journaltitle}{#1}
\DeclareFieldFormat[article]{pages}{\mknormrange{#1}}
\DeclareFieldFormat[article]{doi}{\nkartnfromdoi{#1}{.}}

\DeclareNameFormat[article]{author}{%
\namepartfamily\space\namepartgiveni%
\ifthenelse{\value{listcount}<\value{liststop}}{,\space}{\ifmorenames{,\space\textit{et al}}{}}%
}

\DeclareBibliographyDriver{article}{%
\usebibmacro{begentry}%
\iffieldundef{override}{%
\printnames{author}%
\newblock%
\printfield{title}%
\newblock%
\iffieldundef{shortjournal}{\printfield{journaltitle}}{\printfield{shortjournal}}\newunit\printfield{year}%
\newunit%
\printfield{volume}\iffieldundef{number}{}{(\printfield{number})}:\space%\nolinebreak%
\iffieldundef{pages}{\printfield{doi}}{\printfield{pages}}%
}{\printfield{override}}
\usebibmacro{finentry}%
}
